//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "management\fn_initializeObjects.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_count","_instances","_instance_id","_jip_instance","_instance_content","_mission_objects","_object","_actions","_action","_x"];
_count = 0;
_instances = JIPGETVAR(QGVAR(MISSION_INSTANCES),[]);
{
	_instance_id = _x;
	TRACE_1("Instance ID",_instance_id);
	_jip_instance = [_instance_id] call FFUNC(getMissionInstance);
	_mission_objects = [_jip_instance, "__MISSION_OBJECTS__",[]] call CFUNC(HashGet);
	TRACE_2("Objects",count _mission_objects,_mission_objects);
	{
		_object = _x;
		_actions = [_object] call FFUNC(getActions);
		TRACE_1("Object",ARR_3(typeof _object, _object,count _actions));
		{
			_action = _x;
			[_object, _action] call FFUNC(registerObject);
		} foreach _actions;
	} foreach _mission_objects;
}foreach _instances;

TRACE("End");
TMFPROFILERSTOP;
